﻿using Model;
using Model.ViewModel;
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Net.Http;
using System.Web;
using System.Web.Http;
using SYT.AliApiHandle;

namespace SYT.Web.WebApi
{
    public class EditSalesVolumesAPIController : ApiController
    {
        // GET api/<controller>
        public IEnumerable<string> Get()
        {
            return new string[] { "value1", "value2" };
        }
        //
        public string Products()
        {
            string parameter1 = HttpContext.Current.Request["parameter1"];
            string parameter2 = HttpContext.Current.Request["parameter2"];
            string PageIndex = HttpContext.Current.Request["PageIndex"];

            Users user = JsonConvert.DeserializeObject<Users>(HttpContext.Current.Session["UserreAllInfo"].ToString());
            string Currentcount = "0";
            //根据搜索条件请求数据
            List<ProductModel> products = GetApiShopInfo.GetProListEdit(PageIndex, parameter1, parameter2, user.memberId, out Currentcount);

            // 返回json格式的产品对象集合
            var dataInfo = new { Currentcount = Currentcount, products = products };
            return JsonConvert.SerializeObject(dataInfo);
        }

      

        // PUT api/<controller>/5
        public void Put(int id, [FromBody]string value)
        {
        }

        // DELETE api/<controller>/5
        public void Delete(int id)
        {
        }
    }
}